package utility

import (
	"gopkg.in/yaml.v2"
)

func GetMysqlConfig() (MysqlConfig, error) {
	yamlContent, _ := ReadYamlFile("./mysql.yaml")
	var mysqlConfig MysqlConfig = MysqlConfig{}
	err := yaml.Unmarshal(yamlContent, &mysqlConfig)
	if err != nil {
		panic("解析mysql yaml失败")
	}
	return mysqlConfig, nil
}

func GetSerialConfig() (SerialConfig, error) {
	yamlContent, _ := ReadYamlFile("./serial.yaml")
	var serialConfig SerialConfig = SerialConfig{}
	err := yaml.Unmarshal(yamlContent, &serialConfig)
	if err != nil {
		panic("解析serial yaml失败")
	}
	return serialConfig, nil
}

//func Get

//func (c *conf) getConf() *conf {
//
//	if err != nil {
//		log.Printf("yamlFile.Get err   #%v ", err)
//	}
//	err = yaml.Unmarshal(yamlFile, c)
//	if err != nil {
//		log.Fatalf("Unmarshal: %v", err)
//	}
//
//	return c
//}

